﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery formValidator</title>
<meta name="Author" content="猫冬" />
<meta name="description" content="jQuery formValidator表单验证插件" />
<meta name="keywords" content="jQuery,formValidator,插件,表单,验证,插件,javascript,表单验证,提示层" />
<script src="jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="formValidator-4.1.3.js" type="text/javascript" charset="UTF-8"></script>
<script src="formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
<script type="text/javascript">
$(function(){
	$.formValidator.initConfig({
		formID:"tt",
		theme:'ArrowSolidBox',
		mode:'AutoTip',
		onError:function(msg){alert('2222')}
   });
 
	$("#username").formValidator({onShow:"请输入用户名",onFocus:"用户名至少6个字符,最多10个字符",onCorrect:"该用户名可以注册"}).inputValidator({min:6,max:10,onError:"你输入的用户名非法,请确认"}).regexValidator({regExp:"username",dataType:"enum",onError:"用户名格式不正确"})
	    .ajaxValidator({
		dataType : "json",
		async : true,
		
		url : "http://localhost/formvalidator/demo/dem0.php",
		
		success : function(data){
            if( data == "a" ) return true;
		},
		buttons: $("#button"),              
		error: function(jqXHR, textStatus, errorThrown){
			alert("服务器没有返回数据，可能服务器忙，请重试"+errorThrown);},              
			onError : "该用户名不可用，请更换用户名",              
			onWait : "正在对用户名进行合法性校验，请稍候..."
	    })
   })
</script>
<style type="text/css">
body,div{font-size:12px;}
tr{height:32px;}
</style>
</head>
<body>
<form action="" id="tt">
<table border="0px" style="font-size:12px" width="730px">
<tr> 
<td align="right" width="135px">用户名:</td>
<td width="265px"><input type="text" id="username" name="username" style="width:120px"/></td>
</tr>
</table>
</form>

</body>
</html>